import request from '@/utils/request'

const baseUrl = '/vulnerability'

//导入shp文件
export function uploadShp(data) {
  return request({
    url: `${baseUrl}/uploadShp`,
    method: 'post',
    data: data
  })
}

//导入excel文件
export function uploadExcel(data) {
  return request({
    url: `${baseUrl}/uploadExcel`,
    method: 'post',
    data: data
  })
}

//分页查询
export function queryByPage(params) {
  return request({
    url: `${baseUrl}/page`,
    method: 'get',
    params: params
  })
}

//详情页
export function findById(id, type) {
  let params = {
    id: id,
    type: type
  };
  return request({
    url: `${baseUrl}/findById`,
    method: 'get',
    params: params
  })
}

//字典项查询
export function getValueByDictCodeAndKey(dictCode, key) {
  return request({
    url: '/base/dicts/getValueByDictCodeAndKey',
    method: 'get',
    params: {
      dictCode: dictCode,
      key: key
    }
  })
}

//字典表查询
export function getValidDictItemsByDictCode(dictCode) {
  return request({
    url: '/base/dicts/getValidDictItemsByDictCode',
    method: 'get',
    params: {
      dictCode: dictCode
    }
  })
}

//修改数据
export function updateData(data) {
  //map,type
  return request({
    url: `${baseUrl}/update`,
    method: 'post',
    data: data
  })
}

//删除数据
export function deleteData(data) {
  //map,type
  return request({
    url: `${baseUrl}/delete`,
    method: 'post',
    data: data
  })
}

//桥梁--删除数据
export function bridgeDeleteData(data) {
  //map:ids,flag
  return request({
    url: `${baseUrl}/bridgeDelete`,
    method: 'post',
    data: data
  })
}

//桥梁--详情页
export function bridgeFindById(id, flag) {
  return request({
    url: `${baseUrl}/bridgeFindById`,
    method: 'get',
    params: {
      id: id,
      flag: flag
    }
  })
}